<template>
    <div>
        <el-table
            ref="orgTable"
            :data="tableData"
            @selection-change="getSelectVal"
        >
            <el-table-column type="selection" width="55" align="center">
            </el-table-column>
            <el-table-column property="userId" label="录入人"></el-table-column>
            <el-table-column
                property="orderId"
                label="采购订单id"
            ></el-table-column>
            <el-table-column
                property="address"
                label="核算组织"
            ></el-table-column>
            <el-table-column
                property="purchaseTermsId"
                label="采购条款id"
            ></el-table-column>
            <el-table-column property="type" label="关联类型"></el-table-column>
            <el-table-column
                property="changeTime"
                label="更新时间"
            ></el-table-column>
            <el-table-column
                property="createTime"
                label="创建时间"
            ></el-table-column>
        </el-table>
        <el-pagination
            class="pagination"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
        >
        </el-pagination>
    </div>
</template>

<script>
import { getOrderPurchaseTermsList } from "@/api/system/purchase";
export default {
    data() {
        return {
            tableData: [],
            currentPage: 1, //当前页
            pageSize: 10, //每页条数
            total: 0,
        };
    },
    methods: {
        //分页器size
        handleSizeChange(val) {
            this.pageSize = val;
            this.getDataList();
        },
        //分页器当前页
        handleCurrentChange(val) {
            this.currentPage = val;
            this.getDataList();
        },
        getSelectVal(val) {
            if (val.length) {
                this.$emit("update:visible", false);
                this.$emit("getSelectVal", val);
            }
        },
        getDataList() {
            getOrderPurchaseTermsList({
                page: this.currentPage,
                limit: this.pageSize,
            }).then((res) => {
                this.tableData = res.rows;
            });
        },
    },
    mounted() {
        this.getDataList();
    },
};
</script>

<style></style>
